//
//  MSTagsView.h
//  PeopleForTheFirstMall
//
//  Created by ms on 2022/5/7.
//  Copyright © 2022 MS. All rights reserved.
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

/**
 * 横向滑动标签集view，可设置title、subtitle、title底层贴图和选中下划线，为避免出现上下滑动效果，需设置足够大的height
 * 默认 title+下划线
 */
@interface MSTagsView : UIScrollView

/** (title+subtitle)边界，default UIEdgeInsetsZero */
@property (nonatomic, assign) UIEdgeInsets insets;
/** 间距，default 49px */
@property (nonatomic, assign) CGFloat itemSpace;
/** 选中下标，default 0*/
@property (nonatomic, assign) NSInteger idxForSelectedItem;
/** 隐藏副标题，default YES */
@property (nonatomic, assign) BOOL hiddenSubtitle;
/** 隐藏选中标识下划线，default NO*/
@property (nonatomic, assign) BOOL hiddenLine;
/** 标签底层插入贴图，default NO */
@property (nonatomic, assign) BOOL insertStickers;
/** 选中标签自动滑动到中间，default YES */
@property (nonatomic, assign) BOOL autoScrollToCenter;

/** 点击回调 */
@property (nonatomic, copy) void(^didSelectItemBlock)(NSInteger idx);
/** 刷新tagsView */
- (void)reloadTagsView;


#pragma mark - 设置标签
/** 标签数量 */
@property (nonatomic, copy) NSInteger(^numberOfLabelsInTagsViewBlock)(void);
/** 非选中标签背景图，default nil */
@property (nonatomic, copy) UIImage *(^unselectedLabelBackgroundImageBlock)(NSInteger idx);
/** 选中标签背景图，default nil */
@property (nonatomic, copy) UIImage *(^selectedLabelBackgroundImageBlock)(NSInteger idx);
/** 标签圆角，default 0 */
@property (nonatomic, copy) CGFloat(^labelCornerRadiiBlock)(NSInteger idx);
/** 标签大小，default 文字宽 */
@property (nonatomic, copy) CGSize(^labelSizeBlock)(NSInteger idx);
/** 标签文字与背景图间距，用于计算标签大小，优先级低于itemWidthBlock()，default （1, 1, 1, 1） */
@property (nonatomic, copy) UIEdgeInsets(^labelTextInsetsBlock)(NSInteger idx);


#pragma mark - 设置标签文字
/** 标题 */
@property (nonatomic, copy) NSString *(^titleForItemBlock)(NSInteger idx);
/** 非选中标签文字颜色，default #BDBDBD */
@property (nonatomic, copy) UIColor *(^unselectedLabelTextColorBlock)(NSInteger idx);
/** 选中标签文字颜色，default #5ED3D2 */
@property (nonatomic, copy) UIColor *(^selectedLabelTextColorBlock)(NSInteger idx);
/** 非选中标签字体，default MEDIUM_PINGFANG_FONT_OF_SIZE(16) */
@property (nonatomic, copy) UIFont *(^unselectedLabelTextFontBlock)(NSInteger idx);
/** 选中标签字体，default MEDIUM_PINGFANG_FONT_OF_SIZE(17) */
@property (nonatomic, copy) UIFont *(^selectedLabelTextFontBlock)(NSInteger idx);


#pragma mark - 设置副标签，hiddenSubtitle=NO时有效
/** 副标题大小，default 文字宽+26px */
@property (nonatomic, copy) CGFloat(^subLabelWidthBlock)(NSInteger idx);
/** 副标题与标题间距，default 8px */
@property (nonatomic, copy) CGFloat(^subLabelToLabelSpacingBlock)(void);
/** 副标题 */
@property (nonatomic, copy) NSString *(^subtitleForItemBlock)(NSInteger idx);
/** 非选中副标题文字颜色，default #BDBDBD */
@property (nonatomic, copy) UIColor *(^unselectedSubLabelTextColorBlock)(NSInteger idx);
/** 选中副标题文字颜色，default #5ED3D2 */
@property (nonatomic, copy) UIColor *(^selectedSubLabelTextColorBlock)(NSInteger idx);
/** 非选中副标题字体，default MEDIUM_PINGFANG_FONT_OF_SIZE(16) */
@property (nonatomic, copy) UIFont *(^unselectedSubLabelTextFontBlock)(NSInteger idx);
/** 选中副标题字体，default MEDIUM_PINGFANG_FONT_OF_SIZE(17) */
@property (nonatomic, copy) UIFont *(^selectedSubLabelTextFontBlock)(NSInteger idx);
/** 副标题背景图，default nil */
@property (nonatomic, copy) UIImage *(^unselectedSubLabelBackgroundImageBlock)(NSInteger idx);
/** 副标题选中背景图，default nil */
@property (nonatomic, copy) UIImage *(^selectedSubLabelBackgroundImageBlock)(NSInteger idx);
/** 副标签圆角，default 0 */
@property (nonatomic, copy) CGFloat(^subLabelCornerRadiiBlock)(NSInteger idx);


#pragma mark - 设置标识线，hiddenLine=NO时有效
/** 标识线颜色，default #5ED3D2 */
@property (nonatomic, copy) UIColor *(^lineColorBlock)(void);
/** 标识线颜色，default nil */
@property (nonatomic, copy) UIImage *(^lineImageBlock)(void);
/** 标识线大小，default (49px, 6px) */
@property (nonatomic, copy) CGSize(^lineSizeBlock)(void);
/** 标识线圆角大小，default 0*/
@property (nonatomic, copy) CGFloat(^lineCornerRadiiBlock)(void);
/** 标识线与title/subtitle距离，default 8px*/
@property (nonatomic, copy) CGFloat(^lineToTitleOrSubTitleSpacingBlock)(void);


#pragma mark - 设置标签小贴图，insertStickers=YES时有效
/** 选中贴图 */
@property (nonatomic, copy) UIImage *(^selectedStickerImageBlock)(NSInteger idx);
/** 贴图底部与标签底部距离，默认0 */
@property (nonatomic, copy) CGFloat(^stickerBottomToLabelBlock)(NSInteger idx);
/** 贴图右边与标签右边距离，默认0 */
@property (nonatomic, copy) CGFloat(^stickerRightToLabelBlock)(NSInteger idx);
/** 贴图大小，默认(22px, 14px) */
@property (nonatomic, copy) CGSize(^stickerSizeBlock)(NSInteger idx);

@end

NS_ASSUME_NONNULL_END
